package mail

import (
	"gitee.com/yangguoliang001/go-gin-vue3/services/mailService"
	"github.com/gin-gonic/gin"
	"github.com/go-redis/redis/v7"
	"gorm.io/gorm"

	"go.uber.org/zap"
)

type Controller interface {
	QueryMailInfo(c *gin.Context)
	UpdateMailInfo(c *gin.Context)
}

type mailController struct {
	Cache       *redis.Client
	Logger      *zap.Logger
	MailService mailService.MailService
}

func New(logger *zap.Logger, db *gorm.DB, cache *redis.Client) Controller {
	return &mailController{
		Cache:       cache,
		Logger:      logger,
		MailService: mailService.New(cache, db),
	}
}
